# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=chiasm-shell
pkgver=33.e20ed9f
_pyver=3.13
pkgrel=19
pkgdesc='Python-based interactive assembler/disassembler CLI, powered byKeystone/Capstone.'
groups=('blackarch' 'blackarch-disassembler')
arch=('any')
url='https://github.com/0xbc/chiasm-shell'
license=('MIT')
depends=('python' 'python-keystone' 'python-capstone')
makedepends=('git' 'python-setuptools')
source=("git+https://github.com/0xbc/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  #sed 's|keystone-engine|keystone|g' -i setup.py
}

build() {
  cd $pkgname

  python setup.py build
}

package() {
  cd $pkgname

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  touch "$pkgdir/usr/lib/python$_pyver/site-packages/chiasm_shell/VERSION"
}

